package com.wanggsx.componentdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.Button

import com.alibaba.android.arouter.facade.annotation.Route

import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.alibaba.android.arouter.launcher.ARouter
import com.wanggsx.library.util.arouter.ConstrantRoutes

@Route(path = ConstrantRoutes.APP_ACTIVITY_SECOND)
class SecondActivity : AppCompatActivity() {

    @BindView(R.id.btnClick_second_activity)
    lateinit var btn : Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.app_activity_second)
        ButterKnife.bind(this@SecondActivity)
        btn.text = "here is app SecondActivity"
    }

    @OnClick(R.id.btnClick_second_activity)
    fun onViewClicked(v : View){
        when(v.id){
            R.id.btnClick_second_activity -> {
                ARouter.getInstance().build(ConstrantRoutes.MODULE1_ACTIVITY_MAIN).navigation()
                this@SecondActivity.finish()
            }
        }

    }
}